/* 
根据api文档获取数据 
包含N个接口请求函数模块
函数返回值：promise
*/
import ajax from './ajax.js'
const baseUrl = '/api'


// 1.根据经纬度获取位置
export const reqAddres = geohash => ajax(`${baseUrl}v2/pois/${geohash}`) //paras 传参
// 2.获取食品分类列表
export const reqFoodCategorys = () => ajax(`${baseUrl}v2/index_entry`)
// 3.根据经纬度获取商铺列表
export const reqShops = (longitude, latitude) => ajax(`${baseUrl}shopping/restaurants`, { longitude, latitude }) //query传参
// 4.根据经纬度和关键字获取商铺列表
// 5.获取一次性验证码
export const reqCode = () => ajax(`${baseUrl}v1/captchas`, {}, 'POST')
// 6.用户密码登录
export const reqPwdLogin = ({ username, password, captcha_code }) => ajax(`${baseUrl}v2/login`, { username, password, captcha_code }, 'POST')
// 7.发送短信验证码
// 8.手机号验证码登录
// 9.获取用户信息,自动登录
export const reqUserInfo = () => ajax(`${baseUrl}v1/user`)
// 10.用户登出
//11.获取店铺的分类食品
export const reqShopGood = ({ restaurant_id }) => ajax(`${baseUrl}shopping/v2/menu`, { restaurant_id })
//12.获取店铺名字
export const reqshopName = shopid => ajax(`${baseUrl}shopping/restaurant/${shopid}`)